Skip to content

Fix category count after frontend listing delete#148

Merged
sorinmarta merged 1 commit into
masterfrom
fix/3183-category-count-on-delete
Jul 20, 2026
Merged

Fix category count after frontend listing delete#148
sorinmarta merged 1 commit into
masterfrom
fix/3183-category-count-on-delete

Conversation

@sorinmarta

@sorinmarta sorinmarta commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #3183

Use the deleted WP_Post from after_delete_post so awpcp_delete_ad fires and clears the categories list cache after frontend Delete Listing.

Use deleted WP_Post from after_delete_post so awpcp_delete_ad clears the categories cache.
@sorinmarta sorinmarta added run analysis Run the phpcs run tests Run the unit tests labels Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7068bab8-ac3d-459c-8f3a-01f8ea661cab

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce0c61 and cbd8e02.

📒 Files selected for processing (1)
  • includes/listings/class-delete-listing-event-listener.php

Walkthrough

The listing deletion listener now registers for two after_delete_post arguments, dispatches directly when given a matching WP_Post, and retains the existing post ID fallback path.

Changes

Listing deletion event handling

Layer / File(s) Summary
Post deletion listener dispatch
includes/listings/class-delete-listing-event-listener.php
The hook registration now passes two arguments, and after_delete_post dispatches awpcp_delete_ad with matching WP_Post objects while preserving the post ID fallback.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing category count updates after a frontend listing delete.
Description check ✅ Passed The description is directly related and accurately summarizes the deleted-post handling change and cache fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3183-category-count-on-delete

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.2.5)

PHPStan was skipped because the user-provided config is missing the required paths: directive.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sorinmarta
sorinmarta merged commit c3d41e4 into master Jul 20, 2026
12 checks passed
@sorinmarta
sorinmarta deleted the fix/3183-category-count-on-delete branch July 20, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run analysis Run the phpcs run tests Run the unit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant